﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace System.Data.DataSetGenerator
{
    internal class FileUtil
    {
        internal static void ClearReadOnlyFlag(String fileName)
        {
            FileInfo fi = new FileInfo(fileName);
            if (fi.Exists)
            {
                fi.Attributes = fi.Attributes & (~FileAttributes.ReadOnly);
            }
        }

        internal static void CheckFileExists(String fileName)
        {
            if (String.IsNullOrEmpty(fileName))
                throw new ArgumentException("File name is invalid", fileName);

            if (!File.Exists(fileName))
                throw new FileNotFoundException("File not found", fileName);
        }
    }
}
